
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<span style="font-size:18px;">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="attendance/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="attendance/css/commonly-used-show.css" />
    <script type="text/javascript" src="attendance/js/jquery.min.js"></script>
    <script type="text/javascript" src="attendance/js/bootstrap.js" ></script>

    <title>我的课程</title>

</head>

<body class="mybody">

 <jsp:include page="theTopMenuUser.jsp" />

 <div class="container-fluid">
    <div class="row">
        <div class="col-md-2">
            <div class="text-center" id="left-content">
                <div class="list-group">
                    <a href="${pageContext.request.contextPath}/user" class="list-group-item active">首页</a>
                </div>
                <div class="list-group">
                    <a href="${pageContext.request.contextPath}/clockInClass" class="list-group-item">打卡签到</a>
                    <a href="${pageContext.request.contextPath}/attendanceRecord" class="list-group-item">考勤记录</a>
                    <a href="${pageContext.request.contextPath}/requestForAbsence" class="list-group-item">请假申请</a>
                    <a href="${pageContext.request.contextPath}/askForLeaveToSee" class="list-group-item">请假查看</a>

                </div>
            </div>
        </div>

        <div class="col-md-10">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-primary">
                        <div class="panel-heading">课程简介</div>
                        <div class="panel-body">

                            <div class="alert alert-warning">
                                <img id="course_img" src="" width="500px" height="500px">

                                <div style="float: right; width: 500px; height: 500px">
                                    <div style="padding: 20px;">
                                        <p id="course_title" style="font-size: 20px;">课程名称</p>
                                        <p>主讲教师：<span id="teacher_name">XX</span></p>
                                        <hr style="filter: alpha(opacity=100,finishopacity=0,style=3)" width="100%" color="#6f5999" size="3" />
                                        <p style="font-size: 16px;">课程介绍：<span id="synopsis" style="font-size: 16px;">XXXX</span></p>
                                    </div>
                                </div>


                            </div>
                        </div>

                    </div>
                </div>

            </div>
        </div>

    </div>

</div>

<script type="text/javascript">
    var userdt = JSON.parse(sessionStorage.getItem("user"));
    if (userdt.result.userName != null){
        $("#usname").text(userdt.result.userName);
    }else {
        $("#usname").text(userdt.result.userLoginName);
    }

    window.onload = function(){
        couserInfo();
    }

    function couserInfo(){
        var postUrl = "${pageContext.request.contextPath}/member/queryCourseInfo";
        var str = {
            "id": "${param.id}"
        };

        $.ajax({
            type:"post",
            url:postUrl,
            headers: {
                "Content-Type":"application/json"
            },
            data:JSON.stringify(str),
            contentType: "application/json; charset=utf-8",
            dataType:"json",
            success:function(data){
                if (data.status == "0"){
                    alert(data.msg)
                }else {
                    sessionStorage.setItem("course",JSON.stringify(data));
                    $("#course_title").html(data.result.courseTitle);
                    $("#teacher_name").html(data.result.instructor);
                    $("#synopsis").html(data.result.courseIntroduction);
                    if (data.result.classPictures != null){
                        $("#course_img").attr("src", "${pageContext.request.contextPath}" + data.result.classPictures);
                    }else {
                        $("#course_img").attr("src", "attendance/img/no_date.jpeg");
                    }

                }
            },
            error:function(xhr,state,errorThrown){
                //alert("发生网络错误，错误码为：" + xhr.status)
                location.href = "${pageContext.request.contextPath}/error";
            }
        });
    }

</script>

</body>
</html>
</span>